package Proj_pack;

import java.util.HashMap;

public class Graph {
	
	private HashMap<Integer, Knoten> knmap;
	
	
	public Graph(){
		knmap = new HashMap<Integer, Knoten>();
	}
	
	public synchronized void addKn(Knoten kn){
		knmap.put(kn.getId(), kn);
		
	}
	
	public synchronized Knoten getKn(int id){
		return knmap.get(id);
	}

	public synchronized HashMap<Integer, Knoten> getKnmap() {
		return knmap;
	}

	public synchronized void setKnmap(HashMap<Integer, Knoten> knmap) {
		this.knmap = knmap;
	}
	
	@Override
	public String toString(){
		StringBuffer sb = new StringBuffer();
		for (Knoten k : knmap.values()){
			sb.append(" " + k + " ");
		}
		return sb.toString();
	}

	
}
